package cn.zyq.ykb.controller.h5.msg;

import cn.zyq.ykb.beans.msg.Msg;
import cn.zyq.ykb.service.msg.MsgService;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.common.PageParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 消息表
 * 2023-05-10 19:41:40
 */

@Api(tags = "消息表")
@RestController(value = "appMsgController")
@RequestMapping(value = "/api/msg")
public class MsgController extends BaseController {

    @Resource
    private MsgService msgService;

    @ApiOperation(value = "消息列表", response = Msg.class)
    @PostMapping(value = "/list")
    public Object list(@RequestBody PageParam pageParam) {
        return this.msgService.h5List(pageParam, this.getLoginUser());
    }

    @ApiOperation(value = "用户未读消息分类统计")
    @GetMapping(value = "/statistics")
    public Object statistics(){
        return this.msgService.statistics(this.getLoginUser());
    }


    @ApiOperation(value = "读取消息详情", response = Msg.class)
    @GetMapping(value = "/detail/{serviceID}")
    public Object detail(@PathVariable(value = "serviceID") String serviceID) {
        return this.msgService.h5Detail(serviceID, this.getLoginUser());
    }
}

